export function emailCheck (email) {
  var emailreg = /^([a-zA-Z0-9]+[_|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/
  if (!emailreg.test(email)) {
    return false
  }
  return true
}
export function pwdCheck (pwd) {
  var pwdreg = /^[a-zA-Z]\w{5,17}$/
  if (!pwdreg.test(pwd)) {
    return false
  }
  return true
}
 /*
时间倒计时插件
TimeDown.js
*/
export function TimeDown(endDateStr) {
    //结束时间
    var endDate = new Date(endDateStr);
    //当前时间
    var nowDate = new Date();
    //相差的总秒数
    var totalSeconds = parseInt((endDate - nowDate) / 1000);
    //天数
    var days = Math.floor(totalSeconds / (60 * 60 * 24));
    //取模（余数）
    var modulo = totalSeconds % (60 * 60 * 24);
    //小时数
    var hours = Math.floor(modulo / (60 * 60));
    modulo = modulo % (60 * 60);
    //分钟
    var minutes = Math.floor(modulo / 60);
    //秒
    var seconds = modulo % 60;
    //输出到页面
    if(hours<=0&&minutes<=0&&seconds<=0){
      return ""
    }else{
       return   hours + ":" + minutes + ":" + seconds;
    }


}
export function phoneNumCheck (phoneNUm) {
  var phoneNumreg = /^[1][3,4,5,7,8][0-9]{9}$/
  if (!phoneNumreg.test(phoneNUm)) {
    return false
  }
  return true
}

export function numberCheck (number) {
  var numberreg = /^\d+(?=\.{0,1}\d+$|$)/
  if (!numberreg.test(number)) {
    return false
  }
  return true
}

export function ValidatePhone (isPhone) {
  var isPhonereq = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/
  if (!isPhonereq.test(isPhone)) {
    return true
  } else {
    return false
  }
}
export function getTIme(date){
  var time = new Date(date)
var year=time.getFullYear();
  var mouth=add0(time.getMonth()+1);
  var day=add0(time.getDate());
  var hours=add0(time.getHours());
  var Minutes=add0(time.getMinutes());
  var Seconds=add0(time.getSeconds());
  return year+'-'+mouth+'-'+day+' '+hours+':'+Minutes+':'+Seconds
}
function add0(str){
  if(Number(str)<=9){
    return '0'+str;
  }else{
    return str;
  }
}

export const appId="wxc6c9bdac9d6a7456";
// export const appId="wxd4b1170d21cfd277"
// 32332d3059050b52e3c1647f3464718e
// export const appId="wxc6c9bdac9d6a7456"
// export const appSecret="e28bb0fdabbc87d94d1063a9671797a2"
export const appSecret="32332d3059050b52e3c1647f3464718e"
export  function toDecimal2(x) {
  var f = parseFloat(x);
  if (isNaN(f)) {
  return false;
  }
  var f = Math.round(x*100)/100;
  var s = f.toString();
  var rs = s.indexOf('.');
  if (rs < 0) {
  rs = s.length;
  s += '.';
  }
  while (s.length <= rs + 2) {
  s += '0';
  }
  console.log(s)
  return s;
  }
